home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / wmsConnect.inc < prev    next >
Encoding:
Text File  |  2003-02-21  |  22.0 KB  |  597 lines

  1. <%
  2. '+-------------------------------------------------------------------------
  3. '
  4. '  Microsoft Windows Media
  5. '  Copyright (C) Microsoft Corporation. All rights reserved.
  6. '
  7. '  File:       wmsconnect.inc
  8. '
  9. '  Contents:    Establishes connection with ASP glue COM object;
  10. '               Connects to the server OM
  11. '               Initializes several global variables such as unhashed server name
  12. '
  13. '  Dependencies: locStrings.inc, wmsConstants.inc
  14. '
  15. '--------------------------------------------------------------------------
  16.  
  17. Dim s_WMSAdmin
  18. Dim g_objServer
  19. Dim g_objPubPoint
  20. Dim g_strServerName
  21. Dim g_strPubPointName
  22.  
  23. Dim g_dwConnectionFailureCode
  24. Dim g_bFailedToStartService
  25. Dim g_strDecodedServerName
  26. Dim g_strEncodedServerName
  27. Dim g_strEncodedPubPointName
  28. Dim g_strPubPointID
  29.  
  30. Dim g_strQueryString
  31. Dim g_bSecureConnection
  32.  
  33. ' Browser type
  34. Dim g_bMSIE
  35. Dim g_bNetscape
  36. Dim g_bOpera
  37.  
  38. ' Browser details
  39. Dim g_dwBrowserType
  40. Dim g_curBrowserVersion
  41. Dim g_strUserAgent
  42. Dim g_strQueryStringServer
  43. Dim g_strQueryStringServerOp
  44. Dim g_CurPageSessionHash
  45.  
  46. Dim qs
  47. Dim posting
  48.  
  49. Server.ScriptTimeout = 90
  50.  
  51. g_objServer = empty
  52. g_objPubPoint = empty
  53.  
  54. g_bMSIE = TRUE
  55. g_bNetscape = FALSE
  56. g_bOpera = FALSE
  57.  
  58. g_curBrowserVersion = "0.0"
  59. g_strUserAgent = ""
  60. g_strQueryStringServer = ""
  61. g_strQueryStringServerOp = ""
  62. g_CurPageSessionHash = empty
  63.  
  64. Set qs = Request.QueryString
  65. Set posting = Request.Form
  66.  
  67. on error resume next
  68.  
  69. ' Connect to WMSASPAdmin.DLL -- binds us to the Windows Media Server's Object Model
  70. '
  71. '  NOTE:  If this fails, then the Windows Media Server's administration components
  72. '  have not been installed properly.  Performing the following actions may help:
  73. '
  74. '   pushd %sytemroot%\system32\windows media\server\admin\web\
  75. '   regsvr32 wmsaspadmin.dll
  76. '
  77. Set s_WMSAdmin = Session( "WMSAdmin" )
  78. if( IsEmpty( s_WMSAdmin ) ) then
  79.     Set s_WMSAdmin = Server.CreateObject("WMSAdminRemote.ASPAdmin")
  80.     Set Session("WMSAdmin") = s_WMSAdmin
  81. end if
  82.  
  83. if( IsEmpty( s_WMSAdmin ) ) then
  84.     if g_bDebugMode then
  85.         STOP    ' WMSASPADMIN.DLL has not been registered or is inaccessible
  86.     end if
  87. end if
  88.  
  89. g_strQueryStringServer = RemoveDangerousCharacters( trim( qs( "server" ) ) )
  90. if( MAX_LEN_SERVERNAME < Len( g_strQueryStringServer ) ) then
  91.     g_strQueryStringServer = ""
  92. end if
  93.  
  94. g_strEncodedServerName = RemoveDangerousCharacters( ServerHashKeyToName( g_strQueryStringServer ) )
  95. g_strDecodedServerName = SafeUnescape( g_strEncodedServerName )
  96. g_strPubPointID = ""
  97. g_strEncodedPubPointName = ""
  98. g_strQueryStringServerOp = RemoveDangerousCharacters( trim( qs( "serverop" ) ) )
  99. if( MAX_LEN_OP < Len( g_strQueryStringServerOp ) ) then
  100.     g_strQueryStringServerOp = ""
  101. end if
  102.  
  103. g_strQueryString = Request.ServerVariables( "PATH_INFO" ) & "?" & RemoveDangerousCharacters( trim( qs ) )
  104.  
  105. 'g_bSecureConnection = ( 0 = StrComp( "1", Request.ServerVariables( "SERVER_PORT_SECURE" ), vbTextCompare ) ) 
  106. g_bSecureConnection = CBool( 0 = StrComp( "on", Request.ServerVariables( "HTTPS" ), vbTextCompare ) )
  107.  
  108. Set g_CurPageSessionHash = Session( "CurrentPage" )
  109. if IsEmpty( g_CurPageSessionHash ) then
  110.     ' Shouldn't happen-- this is performed in global.asa
  111.     Set g_CurPageSessionHash = Server.CreateObject("Scripting.Dictionary")
  112.     Set Session( "CurrentPage" ) = g_CurPageSessionHash
  113.     
  114.     if( FALSE = g_CurPageSessionHash.Exists( "Default" ) ) then
  115.         g_CurPageSessionHash.Add "Default", "server_status.asp"
  116.     end if
  117.     
  118.     if( FALSE = g_CurPageSessionHash.Exists( UCase( g_strQueryStringServer ) ) ) then
  119.         g_CurPageSessionHash.Add UCase( g_strQueryStringServer ), "server_status.asp"
  120.     end if
  121. end if
  122.  
  123. 'BrowserSniff
  124. 'PickStyleSheet
  125.  
  126.  
  127. '////////////////////////////////////////////////////////////////'
  128. '                           Subroutines                          '
  129. '////////////////////////////////////////////////////////////////'
  130.  
  131.  
  132. '////////////////////////////////////////////////////////////////
  133. 'Sub BrowserSniff()
  134.     g_curBrowserVersion = Session( "BrowserVersion" )
  135.     if( 0 = Len( g_curBrowserVersion ) ) then
  136.  
  137.         Dim strBrowser
  138.         Dim objBrowseCap
  139.         
  140.         err.Clear
  141.  
  142.         g_dwBrowserType = brUnknown
  143.         g_strUserAgent = Request.ServerVariables( "HTTP_USER_AGENT" )
  144.       
  145.         Set objBrowseCap = Server.CreateObject( "MSWC.BrowserType" )
  146.         if( 0 = err.number ) then
  147.             strBrowser = objBrowseCap.browser
  148.             if( 0 = StrComp( "IE", strBrowser, vbTextCompare ) ) then
  149.                 g_dwBrowserType = brMSIE
  150.             elseif( 0 = StrComp( "Netscape", strBrowser, vbTextCompare ) ) then
  151.                 g_dwBrowserType = brNetscape
  152.             elseif( 0 = StrComp( "Opera", strBrowser, vbTextCompare ) ) then
  153.                 g_dwBrowserType = brOpera
  154.             end if
  155.             
  156.             g_curBrowserVersion = CCur( objBrowseCap.version )
  157.         end if
  158.  
  159.         if( brUnknown = g_dwBrowserType ) then
  160.             if( 0 < InStr( 1, g_strUserAgent, "MSIE", vbTextCompare ) ) then 
  161.                 g_dwBrowserType = brMSIE
  162.                 g_curBrowserVersion = CCur( Mid( g_strUserAgent, InStr( 1, g_strUserAgent, "MSIE", vbTextCompare ) + 5, 3 ) )
  163.                 if( 0 >= g_curBrowserVersion ) then
  164.                     g_curBrowserVersion = CCur( Mid( g_strUserAgent, InStr( 1, g_strUserAgent, "MSIE", vbTextCompare ) + 5, 1 ) )
  165.                 end if
  166.             elseif( 0 < InStr( 1, g_strUserAgent, "Opera", vbTextCompare ) ) then
  167.                 g_dwBrowserType = brOpera
  168.                 g_curBrowserVersion = CCur( Mid( g_strUserAgent, InStr( 1, g_strUserAgent, "Opera", vbTextCompare ) + 6, 1 ) )
  169.             else
  170.                 g_dwBrowserType = brNetscape
  171.                 if( 0 < InStr( 1, g_strUserAgent, "Gecko", vbTextCompare ) ) then
  172.                     g_curBrowserVersion = CCur( Mid( g_strUserAgent, 9, 1 ) )
  173.                 else
  174.                     g_curBrowserVersion = CCur( Mid( g_strUserAgent, InStrRev( g_strUserAgent, "/", -1, vbTextCompare ) + 1, 1 ) )
  175.                     if( 0 = g_curBrowserVersion ) then
  176.                         g_curBrowserVersion = CCur( Mid( g_strUserAgent, InStr( g_strUserAgent, "/", -1, vbTextCompare ) + 1, 1 ) )
  177.                         if( 2 >= g_curBrowserVersion ) then
  178.                             if( 0 < InStr( 1, g_strUserAgent, "Gecko", vbTextCompare ) ) then
  179.                                 g_curBrowserVersion = CCur( "5.0" )
  180.                             end if
  181.                         end if
  182.                     end if
  183.                 end if
  184.             end if
  185.         end if
  186.  
  187.         Session( "UserAgent" ) = g_strUserAgent
  188.         Session( "BrowserType" ) = g_dwBrowserType        
  189.         Session( "BrowserVersion" ) = g_curBrowserVersion
  190.     else
  191.         g_strUserAgent = Session( "UserAgent" )
  192.         g_dwBrowserType = Session( "BrowserType" )
  193. '        g_curBrowserVersion = Session( "BrowserVersion" )
  194.     end if
  195.  
  196.     ' Set depricated flags
  197.     if( brMSIE = g_dwBrowserType ) then
  198.         g_bMSIE = TRUE
  199.         g_bNetscape = FALSE
  200.         g_bOpera = FALSE
  201.     elseif( brNetscape = g_dwBrowserType ) then
  202.         g_bMSIE = FALSE
  203.         g_bNetscape = TRUE
  204.         g_bOpera = FALSE
  205.     elseif( brOpera = g_dwBrowserType ) then
  206.         g_bMSIE = FALSE
  207.         g_bNetscape = FALSE
  208.         g_bOpera = TRUE
  209.     end if
  210.     
  211. 'End Sub
  212.  
  213.  
  214. '////////////////////////////////////////////////////////////////
  215. 'Sub PickStyleSheet()
  216.  
  217.     'BrowserSniff
  218.     
  219. '    g_strUserAgent = Session( "UserAgent" )
  220. '    g_dwBrowserType = Session( "BrowserType" )
  221. '    g_curBrowserVersion = Session( "BrowserVersion" )
  222.  
  223.     if( 0 = Len( Session( "cssName" ) ) ) then
  224. '        bSecureConnection = CBool( 0 = StrComp( "on", Request.ServerVariables( "HTTPS" ), vbTextCompare ) )
  225. '        if( TRUE = bSecureConnection ) then
  226. '            strProtocol = CStr( "https://" )
  227. '        else
  228. '            strProtocol = CStr( "http://" )
  229. '        end if
  230.         
  231.         if( brMSIE = g_dwBrowserType ) then
  232.             if( MIN_MSIE_VERSION <= g_curBrowserVersion ) then
  233.                 if( 0 >= InStr( g_strUserAgent, "Windows" ) ) then
  234.                     Session( "cssName" ) = "css/wms_macie_admin.css"
  235.                 else
  236.                     Session( "cssName" ) = "css/wmsadmin.css"
  237.                 end if
  238.             end if
  239.         elseif( brNetscape = g_dwBrowserType ) then
  240.             if( MIN_NSCP_VERSION <= g_curBrowserVersion ) then
  241.                 Session( "cssName" ) = "css/wms_ns6_admin.css"
  242.             end if
  243.         elseif( brOpera = g_dwBrowserType ) then
  244.             if( MIN_OPERA_VERSION <= g_curBrowserVersion ) then
  245.                 Session( "cssName" ) = "css/wms_ns6_admin.css"
  246.             end if
  247.         else
  248.             Session( "cssName" ) = "css/wmsadmin.css" & g_dwBrowserType
  249.         end if
  250.     end if
  251.     
  252. 'End Sub
  253.  
  254.  
  255. '////////////////////////////////////////////////////////////////
  256. Sub ConnectToNamedServer( strServerName, strServerOp, byRef objServer )
  257.     if( MAX_LEN_SERVERNAME < Len( trim( strServerName ) ) ) then
  258.         Exit Sub
  259.     end if
  260.     
  261.     if( MAX_LEN_OP < Len( trim( strServerOp ) ) ) then
  262.         Exit Sub
  263.     end if
  264.     
  265.     on error resume next
  266.     g_dwConnectionFailureCode = WMS_SERVER_UNKNOWN
  267.     g_bFailedToStartService = FALSE
  268.  
  269.     if( 0 = strcomp( "kill", strServerOp, vbTextCompare ) ) then
  270.         err.clear
  271.         s_WMSAdmin.StopService( strServerName )
  272.         g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  273.         if( ( WMS_SERVICE_STOPPED <> g_dwConnectionFailureCode ) or ( 0 <> err.number ) ) then
  274.             s_WMSAdmin.StopService( strServerName )
  275.             err.Clear
  276.             g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  277.         end if
  278.         objServer = empty
  279.         if( WMS_SERVICE_STOPPED <> g_dwConnectionFailureCode ) then
  280.             Response.Redirect( "/wmssecure/admin.asp?server=" & g_strQueryStringServer & "&stopping=true" )
  281.         end if
  282.         
  283.         Set Session( "objCachedServer" ) = Empty
  284.         Session( "strCachedServerName" ) = ""
  285.         Set Session( "objCachedPP" ) = Empty
  286.         Session( "strCachedPPID" ) = ""
  287.         Session( "dwCachedServerStatus" ) = -1
  288.         
  289.         Exit Sub
  290.  
  291.     elseif( 0 = strcomp( "start", strServerOp, vbTextCompare ) ) then
  292.         
  293.         Set Session( "objCachedServer" ) = Empty
  294.         Session( "strCachedServerName" ) = ""
  295.         Set Session( "objCachedPP" ) = Empty
  296.         Session( "strCachedPPID" ) = ""
  297.         Session( "dwCachedServerStatus" ) = -1
  298.         
  299.         Session( "ConnectionFailure" ) = FALSE
  300.         if( 0 < Len( strServerName ) ) then
  301.             s_WMSAdmin.StartService( strServerName )
  302.             g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  303.             if( WMS_SERVICE_STARTING = g_dwConnectionFailureCode ) then
  304.                 err.clear
  305.                 Session( "ConnectionFailure" ) = FALSE
  306.             elseif( ( WMS_SERVICE_STARTED <> g_dwConnectionFailureCode ) or ( 0 <> err.number ) ) then
  307.                 on error goto 0
  308.                 Set objServer = s_WMSAdmin.StartService( strServerName )
  309.                 if( IsEmpty( objServer ) ) then
  310.                     s_WMSAdmin.StartService( strServerName )
  311.                     Set objServer = s_WMSAdmin.Connect( strServerName )
  312.                     err.Clear
  313.                 end if
  314.                 g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  315.             end if
  316.             if( WMS_SERVICE_STARTED = g_dwConnectionFailureCode ) then
  317.                 Set objServer = nothing
  318.                 Set objServer = s_WMSAdmin.Connect( strServerName )
  319.                 g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  320.  
  321.                 Set Session( "objCachedServer" ) = objServer
  322.                 Session( "strCachedServerName" ) = UCASE( strServerName )
  323.                 Session( "dwCachedServerStatus" ) = g_dwConnectionFailureCode
  324.                 Set Session( "objCachedPP" ) = Empty
  325.                 Session( "strCachedPPID" ) = ""
  326.  
  327.                 err.Clear
  328.             else
  329.                 on error goto 0
  330.                 ' recurse-- note that op has been changed to nothing
  331.                 g_strQueryStringServerOp = ""
  332.                 ConnectToNamedServer strServerName, "", objServer
  333.                 Exit Sub
  334.             end if
  335.         end if
  336.  
  337.     elseif( 0 = strcomp( "noop", strServerOp, vbTextCompare ) ) then
  338.         Set objServer = Empty
  339.  
  340.     else
  341.         if( 0 < Len( strServerName ) ) then
  342.         
  343.             Dim bDoExpensiveConnect
  344.             bDoExpensiveConnect = TRUE
  345.         
  346.             '
  347.             ' use cached server OM pointer, if possible
  348.             '
  349.             if( 0 = StrComp( UCASE( strServerName ), Session( "strCachedServerName" ) ) ) then
  350.                 if( Empty <> Session( "objCachedServer" ) ) then
  351.                     if( WMS_SERVICE_STARTED = Session( "dwCachedServerStatus" ) ) then
  352.                         
  353.                         on error resume next
  354.                         Set objServer = Session( "objCachedServer" )
  355.                         Session( "strCachedServerName" ) = UCASE( objServer.Name )
  356.                         
  357.                         if( ( 0 = err.number ) and ( 0 < Len( Session( "strCachedServerName" ) ) ) ) then                       
  358.                             bDoExpensiveConnect = FALSE
  359.                             g_dwConnectionFailureCode = WMS_SERVICE_STARTED
  360.                         else
  361.                             err.clear
  362.                         end if
  363.                         
  364.                     end if
  365.                 end if
  366.             end if        
  367.         
  368.             if( bDoExpensiveConnect ) then
  369.                 g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  370.                 if( WMS_SERVICE_STARTED = g_dwConnectionFailureCode ) then
  371.                     if( ( nothing = objServer ) or ( empty = objServer ) ) then
  372.                         Set objServer = s_WMSAdmin.Connect( strServerName )
  373.                         g_dwConnectionFailureCode = s_WMSAdmin.GetServiceStatus( strServerName )
  374.                         err.Clear
  375.  
  376.                         Set Session( "objCachedServer" ) = objServer
  377.                         Session( "strCachedServerName" ) = UCASE( strServerName )
  378.                         Set Session( "objCachedPP" ) = Empty
  379.                         Session( "strCachedPPID" ) = ""
  380.                         Session( "dwCachedServerStatus" ) = g_dwConnectionFailureCode
  381.                         
  382.                     end if                  
  383.                 end if
  384.             end if
  385.         end if
  386.     end if
  387.  
  388.     if ( ( WMS_SERVICE_STARTED <> g_dwConnectionFailureCode ) or ( null = objServer ) or ( null = objServer ) ) then
  389.         if( FALSE = Session( "ConnectionFailure" ) ) and ( CInt( qs("failCode") ) <> g_dwConnectionFailureCode )then
  390.             if( WMS_SERVICE_STARTING = g_dwConnectionFailureCode ) then
  391.                 Session( "ConnectionFailure" ) = TRUE
  392.                 Response.Redirect( "/wmssecure/include/server_stopped.asp?server=" & g_strQueryStringServer & "&failCode=" & g_dwConnectionFailureCode )
  393.             elseif( ( 0 <> StrComp( "/wmssecure/admin.asp", Request.ServerVariables( "PATH_INFO" ), vbTextCompare ) ) and ( 0 <> StrComp( "/wmssecure/include/server_stopped.asp", Request.ServerVariables( "PATH_INFO" ), vbTextCompare ) ) ) then
  394.                 Session( "ConnectionFailure" ) = TRUE
  395.                 Response.Redirect( "/wmssecure/include/server_stopped.asp?server=" & g_strQueryStringServer & "&failCode=" & g_dwConnectionFailureCode )
  396.             elseif( 0 = StrComp( "connect", strServerOp, vbTextCompare ) )then
  397.                 Session( "ConnectionFailure" ) = TRUE
  398.                 Response.Redirect( "/wmssecure/include/server_stopped.asp?server=" & g_strQueryStringServer & "&serverop=" & strServerOp & "&failCode=" & g_dwConnectionFailureCode )
  399.             end if
  400.         end if
  401.     end if
  402.  
  403.     if( objServer ) then
  404.         g_strServerName = objServer.Name
  405.     end if
  406. End Sub
  407.  
  408. '////////////////////////////////////////////////////////////////
  409. '
  410. ' Called everywhere to establish connection to the WM Server.  
  411. '
  412. Sub ConnectToServer()
  413.     if( MAX_LEN_SERVERNAME < Len( g_strEncodedServerName ) ) then
  414.         Exit Sub
  415.     end if
  416.     
  417.     if( 0 < Len( g_strEncodedServerName ) ) then
  418.         g_strServerName = g_strEncodedServerName
  419.         g_strDecodedServerName = SafeUnescape( g_strServerName )
  420.     else
  421.         g_strServerName = ServerHashKeyToName( Request.Form.Item( "server" ) )
  422.         g_strDecodedServerName = SafeUnescape( g_strServerName )
  423.     end if
  424.     
  425.     call ConnectToNamedServer( g_strDecodedServerName, g_strQueryStringServerOp, g_objServer )
  426.     
  427. End Sub
  428.  
  429.  
  430. '////////////////////////////////////////////////////////////////
  431. '
  432. ' Called from pub point pages to establish connection to the specified publishing point.
  433. '
  434. Sub ConnectToPubPoint()
  435.     Dim strPPID
  436.     
  437.     ' always favor Pub Point ID over name
  438.     strPPID = RemoveDangerousCharacters( CStr( trim( qs( "ppID" ) ) ) )
  439.     if( 0 = Len( strPPID ) ) then
  440.         strPPID = RemoveDangerousCharacters( trim( Request.Form( "ppID" ) ) )
  441.     end if
  442.     
  443.     if( MAX_LEN_PPID < Len( strPPID ) ) then
  444.         Exit Sub
  445.     end if
  446.     
  447.     if( 0 < Len( strPPID ) ) then
  448.         ConnectToPubPointID( strPPID )
  449.     end if
  450. End Sub
  451.  
  452.  
  453. '////////////////////////////////////////////////////////////////
  454. Sub ConnectToPubPointID( strPPID )
  455.     strPPID = CStr( trim( strPPID ) )
  456.     if( ( 0 = Len( strPPID ) ) or ( MAX_LEN_PPID < Len( strPPID ) ) ) then
  457.         Exit Sub
  458.     end if
  459.  
  460.     lngPubPointIndex = 0
  461.     g_objPubPoint = empty
  462.     g_strPubPointID = strPPID
  463.  
  464.     Dim bDoExpensiveConnect
  465.     bDoExpensiveConnect = TRUE
  466.     
  467.     if( 0 = StrComp( UCASE( strPPID ), Session( "strCachedPPID" ) ) ) then
  468.         if( Empty <> Session( "objCachedPP" ) ) then
  469.             
  470.             on error resume next
  471.             Set g_objPubPoint = Session( "objCachedPP" )
  472.             Session( "strCachedPPID" ) = UCASE( g_objPubPoint.ID )
  473.             
  474.             if( ( 0 = err.number ) and ( 0 < Len( Session( "strCachedPPID" ) ) ) ) then
  475.                 bDoExpensiveConnect = FALSE
  476.             else
  477.                 Session( "strCachedPPID" ) = ""
  478.                 err.clear
  479.             end if
  480.             
  481.         end if
  482.     end if
  483.     
  484.     if ( bDoExpensiveConnect and ( 0 < Len( g_strPubPointID ) ) ) then
  485.         lngPubPointIndex = PPIDToIndex(g_objServer, strPPID )
  486.         Set g_objPubPoint = g_objServer.PublishingPoints( lngPubPointIndex )
  487.     else
  488.         g_objPubPoint = Session( "objCachedPP" )
  489.     end if
  490.  
  491.     g_strPubPointName = g_objPubPoint.Name
  492.     g_strEncodedPubPointName = SafeEscape( g_objPubPoint.Name )
  493. End Sub
  494.  
  495.  
  496. '////////////////////////////////////////////////////////////////
  497. Sub ConnectToNamedPubPoint( strPPName )
  498.     strPPName = CStr( trim( strPPName ) )
  499.     if( ( 0 = Len( strPPName ) ) or ( MAX_LEN_PPNAME < Len( strPPName ) ) ) then
  500.         Exit Sub
  501.     end if
  502.  
  503.     g_strPubPointName = strPPName
  504.     lngPubPointIndex = 0
  505.     g_objPubPoint = empty
  506.             
  507.     if ( 0 < Len( g_strPubPointName ) ) then
  508.         lngPubPointIndex = PPNameToIndex(g_objServer, g_strPubPointName )
  509.     end if
  510.  
  511.     Set g_objPubPoint = g_objServer.PublishingPoints( lngPubPointIndex )
  512.     g_strPubPointID = g_objPubPoint.ID
  513.  
  514.     Session( "objCachedPP" ) = g_objPubPoint
  515.     Session( "strCachedPPID" ) = g_strPubPointID
  516. End Sub
  517.  
  518.  
  519. '////////////////////////////////////////////////////////////////
  520. '
  521. ' Stash the current page and query string into our global hash table
  522. '
  523. Sub LatchCurrentPage( strUrl, byRef querystring )
  524. '    g_strQueryStringServer = querystring( "server" )
  525.     
  526.     Dim strFullUrl
  527.     Dim strKey
  528.     Dim strItem
  529.     
  530.     if( 0 < Len( g_strQueryStringServer ) ) then
  531.     
  532.         strFullUrl = RemoveDangerousCharacters( strUrl ) & "?server=" & g_strQueryStringServer
  533.         for intLoop = 1 to querystring.Count
  534.             strKey = querystring.Key( intLoop )
  535.             strItem = querystring.Item( intLoop )
  536.             if( 0 <> StrComp( "server", strKey, vbTextCompare ) ) then
  537.                 if( 0 = StrComp( "ppID", strKey, vbTextCompare ) ) then
  538.                     strItem = SafeEscape( RemoveSpecifiedChars( strItem, REGEXP_DANGEROUS_PPID_CHARS ) )
  539.                 else
  540.                     strItem = SafeEscape( RemoveDangerousCharacters( strItem ) )
  541.                 end if
  542.                 strFullUrl = strFullUrl & "&" & RemoveDangerousCharacters( strKey ) & "=" & strItem
  543.             end if
  544.         next
  545.     
  546.         while( g_CurPageSessionHash.Exists( UCase( g_strQueryStringServer ) ) )
  547.             g_CurPageSessionHash.Remove( UCase( g_strQueryStringServer ) )
  548.         wend
  549.   
  550.         g_CurPageSessionHash.Add UCase( g_strQueryStringServer ), strFullUrl        
  551.     end if
  552. end Sub
  553.  
  554. if( 0 = StrComp( "localhost", g_strDecodedServerName, vbTextCompare ) ) then
  555.     g_strDecodedServerName = Application( "strLocalHostName" )
  556. end if
  557.  
  558. '////////////////////////////////////////////////////////////////
  559. '
  560. ' Free the various globals we created by server-side-including this file
  561. '
  562. Sub WMSConnectASPCleanup
  563.     on error resume next
  564.     
  565.     s_WMSAdmin = nothing
  566.     g_objServer = nothing
  567.     g_objPubPoint = nothing
  568.     g_strServerName = nothing
  569.     g_strPubPointName = nothing
  570.  
  571.     g_dwConnectionFailureCode = nothing
  572.     g_bFailedToStartService = nothing
  573.     g_strDecodedServerName = nothing
  574.     g_strEncodedServerName = nothing
  575.     g_strEncodedPubPointName = nothing
  576.     g_strPubPointID = nothing
  577.  
  578.     g_strQueryString = nothing
  579.     g_bSecureConnection = nothing
  580.  
  581.     ' Depricated means of determining browser
  582.     g_bMSIE = nothing
  583.     g_bNetscape = nothing
  584.     g_bOpera = nothing
  585.  
  586.     ' New means of determining browser
  587.     g_dwBrowserType = nothing
  588.     g_curBrowserVersion = nothing
  589.     g_strUserAgent = nothing
  590.     g_strQueryStringServer = nothing
  591.     g_strQueryStringServerOp = nothing
  592.     g_CurPageSessionHash = nothing
  593.  
  594.     qs = nothing
  595.     posting = nothing
  596. End Sub
  597. %>